import {axios} from "../../api/http.js";
import {get_Commodity} from "../../api/Url.js"

Page({

  gotodetails(e) {
    console.log(e.currentTarget.dataset)
     wx.navigateTo({
       url: '../details/details?Id='+e.currentTarget.dataset.id
     })
  },
  data: {
    nbTitle: '热门推荐',
    currentData: 0,
    wupin: []
  },
  search: function () {
    wx.redirectTo({
      url: '../input/input'
    })
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      console.log(options)
      axios(get_Commodity,{commodityClassify:options.Value},"get",(res)=>{
        console.log(res)
        this.setData({
          wupin:res
        })
      })
  },
  //获取当前滑块的index
  bindchange: function (e) {
    const that = this;
    that.setData({
      currentData: e.detail.current
    })
  },
  //点击切换，滑块index赋值
  checkCurrent: function (e) {
    const that = this;

    if (that.data.currentData === e.target.dataset.current) {
      return false;
    } else {

      that.setData({
        currentData: e.target.dataset.current
      })
    }
  }
})